$(function(){
	$("input[type='checkbox']").unbind().on("click",function(){
		if($("input[type='checkbox']").is(':checked'))
			$("#parent_pro").removeClass("hidden");
		else
			$("#parent_pro").addClass("hidden");
	});
	
	$("#save").unbind().on("click",function(){
		var pro_name = $("#pro_name").val();
		var pro_code = $("#pro_code]").val();
		var price = $("#price]").val();
		if(isEmpty(pro_name)&&isEmpty(pro_code)&&isEmpty(price)){
			Alert("用户名和密码不能为空!");
			return false;
		} else if(!check_number(price)){
			Alert("工序价格只能为数字!");
			return false;
		} else if(!check_letter_number(pro_code)){
			Alert("工序编码只能为字母.数字和下划线组成!");
			return false;
		} else{
			var data = {"PRO_NAME":pro_name,"PRO_CODE":pro_code,"PRICE":price};
			$.jsonAjax("procedure","addProce",data,null,null,function(rtnData){
				if(!isEmpty(rtnData)&&rtnData.data.status=="success"){
					location.href = "../procedure/addProce.html";
				} 
			},null);
		}
	});
	
});